package com.java.threadsafe.vsafe1;

import com.java.threadsafe.unvsafe.ThreadEntity;

/*多实例，多线程的方式；最传统的方式，不够灵活-*/
public class Safe {
	public static void main(String args[]){
		Runnable entity1 = new ThreadEntity();
		Runnable entity2 = new ThreadEntity();
		Thread thread1 = new Thread(entity1, "thread1");
		Thread thread2 = new Thread(entity2, "thread2");
		thread1.start();
		thread2.start();
	}
}

/*运行结果:
	thread1 ---- 2
	thread2 ---- 2
	thread2 ---- 3
	thread1 ---- 3
	thread1 ---- 4
	thread2 ---- 4
	thread2 ---- 5
	thread1 ---- 5
	thread2 ---- 6
	thread1 ---- 6
*/